#include "widget.h"
#include "ui_widget.h"
#include <QPushButton>
#include <QLineEdit>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //设计四个按钮，依次让按钮，tab、鼠标单击 成为焦点的策略

    QLineEdit*button1=new QLineEdit(this);
    QLineEdit*button2=new QLineEdit(this);
    QLineEdit*button3=new QLineEdit(this);
    QLineEdit*button4=new QLineEdit(this);

    button1->setGeometry(100,100,200,50);
    button2->setGeometry(100,200,200,50);
    button3->setGeometry(100,300,200,50);
    button4->setGeometry(100,400,200,50);

    button1->setText("Tab:ok 点击:ok");
    button1->setFocusPolicy(Qt::FocusPolicy::StrongFocus);

    button2->setText("Tab:no ok 点击:ok");
    button2->setFocusPolicy(Qt::FocusPolicy::ClickFocus);

    button3->setText("Tab:ok 点击:no ok");
    button3->setFocusPolicy(Qt::FocusPolicy::TabFocus);

    button4->setText("Tab:no ok 点击:no ok");
    button4->setFocusPolicy(Qt::FocusPolicy::NoFocus);
}

Widget::~Widget()
{
    delete ui;
}

